<?php 
defined( '_JEXEC' ) or die( 'Restricted access' );
JHTML::_('behavior.modal', 'a.modal');
?>
<script language="javascript">
popUp = function(linkPopUp){
	window.open( linkPopUp, "Invoice", "menubar=0,location=0,scrollbars=1,height=1000,width=2000" );
}
</script>
<form action="index.php" method="post" name="adminForm">
Date
<?php echo JHTML::_('calendar', $this->lists['search_date'], 'search_date', 'search_date', '%d-%m-%Y', array('class'=>'inputbox', 'size'=>'32',  'maxlength'=>'32')); ?>&nbsp;&nbsp;&nbsp;
<button onclick="this.form.submit();"><?php echo JText::_( 'Search' ); ?></button>
  <div id="editcell">
    <table class="adminlist">
      <thead>
        <tr>
          <th width="2%"> <input type="checkbox" name="toggle" value="" onClick="checkAll(<?php echo count( $this->auctions ); ?>);" />
          </th>
          <th width="2%"> <?php echo JText::_( 'ID' ); ?> </th>
          <th width="10%">Product name</th>
          <th width="10%">Kat no</th>
          <th width="10%">Image</th>
          <th width="10%">Auction date</th>
          <th width="10%">Winning price</th>
          <th width="10%">Desired price</th>
          <th width="8%">Winner</th>
          <th width="8%">Auction history</th>
          <th width="3%">Restore</th>
          <th width="3%">Udskrive</th>
        </tr>
      </thead>
      <?php
	$k = 0;
	for ($i=0, $n=count( $this->auctions); $i < $n; $i++)
	{	
		$row = &$this->auctions[$i];
		$checked 	 = JHTML::_('grid.id',   $i, $row->id );
		$link 		 = JRoute::_( 'index.php?option=com_auction&task=edit&cid[]='. $row->id );
		?>
      <tr class="<?php echo "row$k"; ?>">
        <td align="center"><?php echo $checked; ?></td>
        <td align="center"><?php echo $row->id; ?></td>
        <td align="center"><?php echo $row->model; ?></td>
        <td align="center"><?php echo $row->katno; ?></td>
        <td align="center">
		<?php echo "<img src='".JURI::root(false)."thumbnail/timthumb.php?src=".JURI::root(false)."components/com_ecommerce/imgupload/".$row->image."&w=100&zc=1' title='".$row->model."' alt='".$row->model ."' />";?>
        </td>
        <td align="center"><?php echo $row->auction_date; ?></td>
        <td align="center"><?php echo number_format($row->winprice,0,'','.'); ?> DKK</td>
        <td align="center"><?php echo number_format($row->desiredprice,0,'','.'); ?> DKK</td>
        <td align="center">
		<a class="modal" rel="{handler: 'iframe', size: {x: 350, y: 250}}" href="../index.php?option=com_ecommerce&view=detail&layout=user&tmpl=component&pn=<?php echo $row->winid;?>"><?php echo $row->winid; ?></a></td>
        <td align="center">
		<a class="modal" rel="{handler: 'iframe', size: {x: 500, y: 340}}" href="../index.php?option=com_ecommerce&view=detail&layout=history&tmpl=component&auc_id=<?php echo $row->id;?>">View</a></td>
        <td align="center"><a href="index.php?option=com_auction&controller=history&task=restore&id=<?php echo $row->id;?>"><img src="../images/restore.png" /></a></td>
        <td align="center"><a href="javascript:void(0);" onclick="popUp('../index.php?option=com_ecommerce&view=detail&layout=invoiceinfo&tmpl=component&id=<?php echo $row->id;?>')"><img src="images/print.png" /></a></td>
      </tr>
      <?php
		$k = 1 - $k;
	}
	?>
      <tr>
        <td colspan="16"><?php echo $this->page->getListFooter(); ?> </td>
      </tr>
    </table>
  </div>
  <input type="hidden" name="option" value="com_auction" />
  <input type="hidden" name="task" value="" />
  <input type="hidden" name="boxchecked" value="0" />
  <input type="hidden" name="controller" value="history" />
</form>
